package moodle.android;

import net.patrickpollet.moodlews.core.LoginReturn;
import net.patrickpollet.moodlews.core.Mdl_soapserverBindingStub;
import net.patrickpollet.moodlews.core.UserRecord;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ListAdapter;
import android.widget.ListView;

public class AlumnosCurso extends Activity {
	private ListView lista;
	private CheckBox matriculado;
	private Usuario user = new Usuario();
	private Mdl_soapserverBindingStub moodle = user.getMoodle();			
	private LoginReturn sesion = user.getSesion();
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);      
        setContentView(R.layout.usr_courses);
        
        lista=(ListView) findViewById(R.id.Alumnos_Cursos);
        Bundle bolsa = getIntent().getExtras();
        String id =""+(bolsa.getInt("ID"));//obtiene Id de usuario a consultar
        
        UserRecord[] usrCourse = moodle.get_students(sesion.getClient(),sesion.getSessionkey(),id,"id");
        String[] usuarios = new String[usrCourse.length];
	       for(int x=0;x!=usrCourse.length;x++){
	    	   usuarios[x]=usrCourse[x].getFirstname().toString()+usrCourse[x].getLastname().toString();
	       }
	
	 
	   ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usuarios); 
	   lista.setAdapter(adapter);//carga adaptador a la lista  
	       
	   matriculado=(CheckBox) findViewById(R.id.matriculado);
	   
	   if (matriculado.isChecked()){
		   
		   
	   }
	   
	}
	
}
